<template>
	<view>

		<view class="card tab-group">

			<view class="card tab-box" v-for="(item,index) in tabs" :key="index" @click="toPage(item.url)">
				<image :src="item.icon" class="icon"></image>
				<view class="tit">{{item.name}}</view>
			</view>
			
		</view>

		<backpackVue ref="backRef" :show="backpackShow" @success="handlebackpackVue" />

		<giftPopup :show="giftShow" @success="handlegiftShow" ref="giftPopupRef"></giftPopup>

	</view>
</template>

<script>
	import {
		getPatchManage
	} from '@/api/login.js'
	import giftPopup from '../giftPopup/index.vue'
	import backpackVue from '../backpack.vue';
	export default {
		components: {
			backpackVue,
			giftPopup
		},
		data() {
			return {
				giftShow: false,
				backpackShow: false,
				tabs: [{
					url: 'gift',
					icon: '/static/myimages/m8.png',
					name: '转赠'
				}, {
					url:'/pages/my/share',
					icon: '/static/myimages/share.png',
					name: '分享'
				}, {
					url: '/pages/my/friend',
					icon: '/static/myimages/m7.png',
					name: '我的好友'
				}, {
					url: 'backpack',
					icon: '/static/myimages/m9.png',
					name: '背包'
				}, {
					url: '/pages/my/vip',
					icon: '/static/myimages/m10.png',
					name: '会员中心'
				}, {
					url: '/pages/my/vipCenter',
					icon: '/static/myimages/m17.png',
					name: '卡券中心'
				}, {
					url: '/pages/my/fancyNumber',
					icon: '/static/myimages/m11.png',
					name: '靓号'
				}, {
					url: '/pages/my/Notice',
					icon: '/static/myimages/m13.png',
					name: '公告中心'
				},
				{
					url:'/pages/my/aboutUs',
					icon: '/static/myimages/m14.png',
					name: '关于我们'
				}],
				
			};
		},
		methods: {
			handlebackpackVue(){
				this.backpackShow=false
				this.$emit('success')
			},
			handlegiftShow(){
				this.giftShow = false
				this.$emit('success')
			},
			
			toPage(url) {
				if (url == 'backpack') {
					this.backpackShow = true
					this.$refs.backRef.getMalist()
					return
				}
				if (url == 'gift') {
					this.giftShow = true
					this.$refs.giftPopupRef.setObj()
					return
				}
				if (url) {
					uni.navigateTo({
						url: url
					})
				} else {
					uni.showToast({
						icon: 'none',
						title: '暂未开放'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.Micro{
		width: 18rpx;
		height: 18rpx;
		border-radius: 18rpx;
		background-color: red;
		position: absolute;
		top: 25rpx;
		right: 70rpx;
	}
	.tab-group {
		flex-wrap: wrap;
		padding: 20rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 20rpx;
	}

	.tab-box {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		width: 200rpx;
		height: 140rpx;
	}

	.icon {
		width: 40rpx;
		height: 40rpx;
		display: block;
	}

	.tit {
		margin-top: 10rpx;
		font-size: 24rpx;
		color: #fff;
	}
</style>